# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:ios)

platform :ios do
  @podspec_name = 'MapleBacon.podspec'.freeze

  desc 'Release a new patch version'
  lane :patch do
    release('patch')
  end

  desc 'Release a new minor version'
  lane :minor do
    release('minor')
  end

  desc 'Release a new major version'
  lane :major do
    release('major')
  end

  def release(type)
    pod_lib_lint
    version = version_bump_podspec(path: @podspec_name, bump_type: type)
    git_add(path: @podspec_name)
    git_commit(path: [@podspec_name], message: "#{version} release")
    add_git_tag(tag: version.to_s)
    push_to_git_remote
    pod_push
  end
end
